﻿
Public Class cRetencion
    Private lDaReten As dsContabilidadTableAdapters.CON_RETENCIONTableAdapter
    Private lDtReten As dsContabilidad.CON_RETENCIONDataTable
    Private lDrReten As dsContabilidad.CON_RETENCIONRow
    Sub New(ByVal idRentencion As String)
        lDaReten = New dsContabilidadTableAdapters.CON_RETENCIONTableAdapter
        lDtReten = New dsContabilidad.CON_RETENCIONDataTable
        Try
            lDaReten.FillByIdRetencion(lDtReten, idRentencion)
            If lDtReten.Rows.Count > 0 Then
                lDrReten = lDtReten.Rows(0)
            Else
                Throw New Exception("No existen datos para esta retencion")
            End If
        Catch ex As Exception
            cError.SalvaError(ex, "Samuel")
            Throw ex
        End Try

    End Sub
    Public ReadOnly Property idRetencion() As String
        Get
            Return lDrReten.IDRETENCION
        End Get

    End Property

    Public ReadOnly Property descripcion() As String
        Get
            Return lDrReten.DESCRIPCION
        End Get

    End Property

    Public ReadOnly Property porRetencion() As Double
        Get
            Return lDrReten.PORRETENCION
        End Get

    End Property

    Public ReadOnly Property baseRetencion() As Double
        Get
            Return lDrReten.BASERETENCION
        End Get
        
    End Property

    Protected Overrides Sub Finalize()
        lDrReten = Nothing
        lDtReten = Nothing
        lDaReten = Nothing
    End Sub
End Class
